﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing.Design;
using Microsoft.VisualStudio.Shell.Interop;
using EnvDTE;
using System.ComponentModel;

namespace VsxFactory.Modeling.StrategyManager
{
    internal abstract class ExtenderTypeEditor : UITypeEditor
    {
        protected ProjectItem GetProjectItem(ITypeDescriptorContext context)
        {
            IVsBrowseObject obj2 = context.Instance as IVsBrowseObject;
            if (obj2 != null)
            {
                IVsHierarchy hierarchy;
                uint num;
                obj2.GetProjectItem(out hierarchy, out num);
                object obj;
                if (hierarchy.GetProperty(num, (int)__VSHPROPID.VSHPROPID_ExtObject, out obj) == 0)
                    return obj as ProjectItem;
            }
            return null;
        }
    }
}
